
	<form id="myForm" class="form-horizontal" autocomplete="off" data-validator-option="{theme:'default'}">
		<input id="sid" type="hidden" name="id" value="$!{surfaceWater.id}">
		<div class="form-group" style="padding-top: 3%"><label class="col-sm-2 control-label" style="margin: 0 auto">流域名称:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control"  name="waterShed_name" id="waterShed_name"  value="$!{surfaceWater.waterShed_name}" placeholder="请输入该途径名称" data-rule="名称:required;waterShed_name">
			</div>
		</div>
		<div class="form-group"><label class=" control-label" style="margin: 0 8%">地表径流:</label>
		</div>
		<div class="form-group"><label class=" control-label" style="margin: 0 auto">污染物释放可能性因子值:</label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">1.污染物释放可能性因子值:</label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="likelihood_of_exposure"  >-->
				<select name="Obs_release" value="$!{surfaceWater.Obs_release}" class="form-control" id="Obs_release"style="width: 50%">
					<option>0</option>
					<option>550</option>
				</select>
			</div>
		</div>
		<div class="form-group"><label class=" control-label" style="margin: 0 auto">2.释放可能性因子值:</label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">2a.污染源围堵因子值:<a onclick="surface(this.name)" name="4-2">(4-2)</a></label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="likelihood_of_exposure"  >-->
				<select name="containment" value="$!{surfaceWater.containment}" class="form-control" id="containment"style="width: 50%">
					<option>0</option>
					<option>3</option>
					<option>5</option>
					<option>7</option>
					<option>9</option>
					<option>10</option>
				</select>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">2b.径流强度因子值:<a onclick="surface(this.name)" name="4-6">(4-6)</a></label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="likelihood_of_exposure"  >-->
				<select name="runoff"  value="$!{surfaceWater.runoff}" class="form-control" id="runoff"style="width: 50%">
					<option>0</option>
					<option>1</option>
					<option>2</option>
					<option>3</option>
					<option>4</option>
					<option>7</option>
					<option>11</option>
					<option>15</option>
					<option>17</option>
					<option>25</option>
				</select>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">2c.污染源距离地表水的距离因子值:<a onclick="surface(this.name)" name="4-7">(4-7)</a></label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="likelihood_of_exposure"  >-->
				<select name="dis_surface_water" value="$!{surfaceWater.dis_surface_water}" class="form-control" id="dis_surface_water"style="width: 50%">
					<option>3</option>
					<option>6</option>
					<option>9</option>
					<option>16</option>
					<option>20</option>
					<option>25</option>
				</select>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">2d.污染物释放可能性因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control"  name="overland_flow" id="overland_flow"  value="#if ( $surfaceWater )  $!{surfaceWater.overland_flow}  #else  0  #end" readonly>
			</div>
		</div>
		<div class="form-group"><label class=" control-label" style="margin: 0 auto">3.污染物释放可能性因子值（洪水）:</label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">3a.污染源围堵因子值:<a onclick="surface(this.name)" name="4-8">(4-8)</a></label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="likelihood_of_exposure"  >-->
				<select name="pot_containment" value="$!{surfaceWater.pot_containment}" class="form-control" id="pot_containment"style="width: 50%">
					<option>0</option>
					<option>10</option>
				</select>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">3b.洪水频率因子值:<a onclick="surface(this.name)" name="4-9">(4-9)</a></label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="likelihood_of_exposure"  >-->
				<select name="pot_flood_frequency" value="$!{surfaceWater.pot_flood_frequency}" class="form-control" id="pot_flood_frequency"style="width: 50%">
					<option>0</option>
					<option>7</option>
					<option>25</option>
					<option>50</option>
				</select>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">3c.污染物释放可能性因子值（洪水）:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control"  name="pot_pot_to_rele_flo" id="pot_pot_to_rele_flo"  value="#if ( $surfaceWater ) $!{surfaceWater.pot_pot_to_rele_flo}  #else  0  #end" readonly>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">4.潜在污染物释放可能性因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control"  name="pro_to_release" id="pro_to_release"  value="#if ( $surfaceWater ) $!{surfaceWater.pro_to_release}  #else  0  #end" readonly>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">5.污染物释放可能性因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control"  name="likeihood_release" id="likeihood_release" value="#if ( $surfaceWater ) $!{surfaceWater.likeihood_release}  #else  0  #end" readonly>
			</div>
		</div>
		<div class="hr-line-dashed"></div>


		<!--饮用水-->
		<div class="form-group"><label class=" control-label" style="margin: 0 2%">污染物特征因子值:</label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">6.毒性/持久性:
			<button type="button" class="btn btn-info" onclick="openThreat('dwThreat','dwFade')">移动性</button>
		</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" name="persistence" id="persistence" readonly>
			</div>

			<div id="dwThreat" class="white_content">
				<div class="threatTop">
					<a href = "javascript:void(0)" onclick = "closeThreat('dwThreat','dwFade')" >
						<p style="font-size: 30px;margin-left:95%;display: inline">×</p></a>
				</div>
				<div class="col-sm-10 d2" style="width: 100%;margin-top: 5%">
					<div style="display: inline;float: left;width: 50%;margin-left: 7%">
						<label class=" control-label" style="margin: 0 auto">选择主要元素:</label><br>
					<select id="threat1" multiple="multiple" size="6"  class="form-control"style="height: 10%;display: inline">
					</select>
					</div>
					<div style="display: inline;float: right">
						<label class=" control-label" style="margin: 0 auto">选择主要的水类:</label><br>
						<input type="radio" name="water_category" value="lake" id="lake" onclick=changeThreat('threat1','waterCategory','lake','water')><label style="font-size: 15px;margin-left: 3px">湖泊</label><br>
						<input type="radio" name="water_category" value="river" id="river" onclick=changeThreat('threat1','waterCategory','river','water')><label style="font-size: 15px;margin-left: 3px">河流</label><br>
<br>
						<button type="button" onclick = "closeThreat('dwThreat','dwFade'),maxPersistenceCaculate('PerTox','substance','persistence','haza_quantity','waste_characteristics');" class="btn btn-info">
							保存并返回</button>
					</div>
				</div>
				<div style="padding-top: 30%;">
					<table width="90%" class="tableThreat" id="tableThreat">

					</table>
				</div>
				</div>
			<div id="dwFade" class="black_overlay"></div>




		</div>
		<div class="form-group"><label class="col-sm-2 control-label">使用物质:</label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="substance"  >-->
				<select name="substance" id="substance" class="form-control"style="width: 50%">

				</select>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">7.污染物数量因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control"  name="haza_quantity" id="haza_quantity"  readonly>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">8.污染物特征因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control"  name="waste_characteristics" id="waste_characteristics" value="1"  readonly>
			</div>
		</div>
		<div class="hr-line-dashed"></div>
		<div class="form-group"><label class=" control-label" style="margin: 0 6%">目标因子值:</label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">9.取水口目标因子值:<a onclick="surface(this.name)" name="4-13">(4-13)</a></label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="likelihood_of_exposure"  >-->
				<select name="nearest_intake" value="$!{surfaceWater.nearest_intake}" class="form-control" id="nearest_intake"style="width: 50%">
					<option>20</option>
					<option>45</option>
					<option>50</option>
				</select>
			</div>
		</div>
		<div class="form-group"><label class=" control-label" style="margin: 0 auto">10.人口目标因子值:</label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">10a.暴露于水平1浓度的人口数量：</label>
			<div class="col-sm-10 d1">
				<input type="text"  class="form-control" id="pop_concent1" name="pop_concent1"  placeholder="请输入该目标因子值" data-rule="人口目标因子值1:required;pop_concent1" value="$!{surfaceWater.pop_concent1}">
				<div class="alert alert-warning alert-dismissible" role="alert" style="display: none" id="10aErrMsg">
					<!--data-dismiss="alert" aria-label="Close"-->
					<button  type="button" class="close"  id="10aMsg" onclick="closeErr(this.id)"><span aria-hidden="true">&times;</span></button>
					<strong>错误!</strong> 请输入正确数值！
				</div>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">10b.暴露于水平2浓度的人口数量：</label>
			<div class="col-sm-10 d1">
				<input type="text"  class="form-control" id="pop_concent2" name="pop_concent2"  placeholder="请输入该目标因子值" data-rule="人口目标因子值2:required;pop_concent2" value="$!{surfaceWater.pop_concent2}">
				<div class="alert alert-warning alert-dismissible" role="alert" style="display: none" id="10bErrMsg">
					<!--data-dismiss="alert" aria-label="Close"-->
					<button type="button" class="close"  id="10bMsg" onclick="closeErr(this.id)"><span aria-hidden="true">&times;</span></button>
					<strong>错误!</strong> 请输入正确数值！
				</div>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">10c.暴露于潜在污染的人口数量：<a onclick="surface(this.name)" name="4-14">(4-14)</a></label>
			<div class="col-sm-10 d1">
				<input type="text"  class="form-control" id="potential_contanmination" name="potential_contanmination"  placeholder="请输入该目标因子值" data-rule="潜在人口目标因子值:required;potential_contanmination" value="$!{surfaceWater.potential_contanmination}">
				<div class="alert alert-warning alert-dismissible" role="alert" style="display: none" id="10cErrMsg">
					<!--data-dismiss="alert" aria-label="Close"-->
					<button type="button" class="close"  id="10cMsg" onclick="closeErr(this.id)"><span aria-hidden="true">&times;</span></button>
					<strong>错误!</strong> 请输入正确数值！
				</div>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">10d.人口目标因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" id="population" name="population"  value="#if ( $surfaceWater ) $!{surfaceWater.population}  #else  0  #end" readonly>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">11.资源目标因子值:</label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="likelihood_of_exposure"  >-->
				<select name="resource" value="$!{surfaceWater.resource}" class="form-control" id="resource"style="width: 50%">
					<option>0</option>
					<option>5</option>
				</select>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">12.目标因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" id="target" name="target"  value="#if ( $surfaceWater ) $!{surfaceWater.target}  #else  0  #end" readonly>
			</div>
		</div>
		<div class="hr-line-dashed"></div>
		<div class="form-group"><label class=" control-label" style="margin: 0 3%">饮用水威胁评分:</label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">13.饮用水威胁评分:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" id="drinking_water_score" name="drinking_water_score"  value="#if ( $surfaceWater ) $!{surfaceWater.drinking_water_score}  #else  0  #end" readonly>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label" >未经扫描得分:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" name="uncapped_score"  value="$!{surfaceWater.uncapped_score}" readonly id="uncapped_score">
			</div>
		</div>
		<div class="hr-line-dashed"></div>



		<!--食物链-->
		<div class="form-group"><label class="col-sm-2 control-label">14.污染物释放可能性因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control"  name="likeihood_release2" id="likeihood_release2" value="#if ( $surfaceWater ) $!{surfaceWater.likeihood_release}  #else  0  #end" readonly>
			</div>
		</div>
		<div class="hr-line-dashed"></div>
		<div class="form-group"><label class=" control-label" style="margin: 0 2%">污染物特征因子值:</label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">15.毒性/持久性/生物积累性:
		</label>
			<!--<div class="col-sm-10 d1">
				<input type="text" class="form-control" name=""   value="1" readonly>
			</div>-->
		</div>


		<div class="form-group">
			<label class="col-sm-2 control-label">15a.毒性/持久性:
			<button type="button"  class="btn btn-info" onclick="openThreat('hfThreat','hfFade')">移动性</button>
		</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" name="persistence2" id="persistence2"   value="1" readonly>
			</div>


			<div id="hfThreat" class="white_content">
				<div class="threatTop">
					<a href = "javascript:void(0)" onclick = "closeThreat('hfThreat','hfFade')" >
						<p style="font-size: 30px;margin-left:95%;display: inline">×</p></a>
				</div>
				<div class="col-sm-10 d2" style="width: 100%;margin-top: 5%">
					<div style="display: inline;float: left;width: 50%;margin-left: 7%">
						<label class=" control-label" style="margin: 0 auto">选择主要元素:</label><br>
						<select id="threat2" multiple="multiple" size="6"  class="form-control"style="height: 10%;display: inline">
						</select>
					</div>
					<div style="display: inline;float: right">
						<label class=" control-label" style="margin: 0 auto">选择主要的水类:</label><br>
						<input type="radio" name="water_category2" value="lake" id="lake2" onclick=changeThreat('threat2','waterCategory2','lake','food')><label style="font-size: 15px;margin-left: 3px">湖泊</label><br>
						<input type="radio" name="water_category2" value="river" id="river2" onclick=changeThreat('threat2','waterCategory2','river','food')><label style="font-size: 15px;margin-left: 3px">河流</label><br>

						<label class=" control-label" style="margin: 0 auto">选择水体类型:</label><br>
						<input type="radio" name="body_type" value="fresh" id="fresh" onclick=changeThreat('threat2','bodyType','fresh','food')><label style="font-size: 15px;margin-left: 3px">淡水</label><br>
						<input type="radio" name="body_type" value="salt" id="salt" onclick=changeThreat('threat2','bodyType','salt','food')><label style="font-size: 15px;margin-left: 3px">咸水</label><br>

						<button type="button"  onclick = "closeThreat('hfThreat','hfFade'),maxPersistenceCaculate('PerTox2','substance2','persistence2','haza_quantity2','waste_characteristics2')" class="btn btn-info">
							保存并返回</button>
					</div>
				</div>
				<div style="padding-top: 30%;">
					<table width="90%" class="tableThreat" id="tableThreat2">

					</table>
				</div>
			</div>
			<div id="hfFade" class="black_overlay"></div>

		</div>

		<div class="form-group"><label class="col-sm-2 control-label">使用物质:</label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="substance"  >-->
				<select name="substance2" id="substance2" class="form-control"style="width: 50%">
					<option>Aldrin</option>
					<option>Benzidine</option>
				</select>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">15b.生物积累性:</label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="likelihood_of_exposure"  >-->
				<select name="bioa_val" value="" class="form-control" id="bioa_val"style="width: 50%">
					<option value="0.5">0.5</option>
					<option value="5">5</option>
					<option value="50">50</option>
					<option value="500">500</option>
					<option value="5000">5000</option>
					<option value="50000">50000</option>
				</select>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">16.污染物数量因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control"  name="haza_quantity2" id="haza_quantity2" value="$!{surfaceWater.haza_quantity2}"   readonly>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">17.污染物特征因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control"  name="waste_characteristics2" id="waste_characteristics2"  value="$!{surfaceWater.waste_characteristics2}" readonly>
			</div>
		</div>
		<div class="hr-line-dashed"></div>
		<div class="form-group"><label class=" control-label" style="margin: 0 6%">目标因子值:</label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">18.个人目标因子值:</label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="likelihood_of_exposure"  >-->
				<select name="food_chain_individual" value="" class="form-control" id="food_chain_individual"style="width: 50%">
					<option>0</option>
					<option>20</option>
					<option>45</option>
					<option>50</option>
				</select>
			</div>
		</div>
		<div class="form-group"><label class=" control-label" style="margin: 0 auto">19.人口目标因子值:<a onclick="surface(this.name)" name="4-18">(4-18)</a></label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">19a.暴露于水平1浓度的人口数量：</label>
			<div class="col-sm-10 d1">
				<input type="text"  class="form-control" id="pop_concent12" name="pop_concent12"  placeholder="请输入该目标因子值" data-rule="人口目标因子值1:required;pop_concent1" value="$!{surfaceWater.pop_concent12}">
				<div class="alert alert-warning alert-dismissible" role="alert" style="display: none" id="19aErrMsg">
					<!--data-dismiss="alert" aria-label="Close"-->
					<button type="button" class="close"  id="19aMsg" onclick="closeErr(this.id)"><span aria-hidden="true">&times;</span></button>
					<strong>错误!</strong> 请输入正确数值！
				</div>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">19b.暴露于水平2浓度的人口数量：</label>
			<div class="col-sm-10 d1">
				<input type="text"  class="form-control" id="pop_concent22" name="pop_concent22"  placeholder="请输入该目标因子值" data-rule="人口目标因子值1:required;pop_concent2" value="$!{surfaceWater.pop_concent22}">
				<div class="alert alert-warning alert-dismissible" role="alert" style="display: none" id="19bErrMsg">
					<!--data-dismiss="alert" aria-label="Close"-->
					<button type="button" class="close"  id="19bMsg" onclick="closeErr(this.id)"><span aria-hidden="true">&times;</span></button>
					<strong>错误!</strong> 请输入正确数值！
				</div>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">19c.暴露于潜在污染的人口数量：</label>
			<div class="col-sm-10 d1">
				<input type="text"  class="form-control" id="pot_HFC_concent" name="pot_HFC_concent"  placeholder="请输入该目标因子值" data-rule="人口目标因子值1:required;pot_HFC_concent" value="$!{surfaceWater.pot_HFC_concent}">
				<div class="alert alert-warning alert-dismissible" role="alert" style="display: none" id="19cErrMsg">
					<!--data-dismiss="alert" aria-label="Close"-->
					<button type="button" class="close"  id="19cMsg" onclick="closeErr(this.id)"><span aria-hidden="true">&times;</span></button>
					<strong>错误!</strong> 请输入正确数值！
				</div>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">19d.人口目标因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" id="population2" name="population2"  value="#if ( $surfaceWater ) $!{surfaceWater.population2}  #else  0  #end" readonly>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">20.目标因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" id="target2" name="target2"  value="#if ( $surfaceWater ) $!{surfaceWater.target2}  #else  0  #end" readonly>
			</div>
		</div>
		<div class="hr-line-dashed"></div>
		<div class="form-group"><label class=" control-label" style="margin: 0 3%">食物链威胁评分:</label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">21.食物链威胁评分:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" id="human_food_chain_score" name="human_food_chain_score"  value="#if ( $surfaceWater ) $!{surfaceWater.human_food_chain_score}  #else  0  #end" readonly>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label" >未经扫描得分:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" name="uncapped_score2"  value="$!{surfaceWater.uncapped_score2}" readonly id="uncapped_score2">
			</div>
		</div>
		<div class="hr-line-dashed"></div>
		<div class="form-group"><label class="col-sm-2 control-label">22.污染物释放可能性因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control"  name="likeihood_release3" id="likeihood_release3" value="#if ( $surfaceWater ) $!{surfaceWater.likeihood_release}  #else  0  #end" readonly>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">23.毒性/持久性/生物积累性:
		</label>
			<!--<div class="col-sm-10 d1">
				<input type="text" class="form-control" name=""   value="1" readonly>
			</div>-->
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">23a.毒性/持久性:
			<button type="button"  class="btn btn-info" onclick="openThreat('eThreat','eFade')">移动性</button>
		</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" name="persistence3" id="persistence3"   value="1" readonly>
			</div>


			<div id="eThreat" class="white_content">
				<div class="threatTop">
					<a href = "javascript:void(0)" onclick = "closeThreat('eThreat','eFade')" >
						<p style="font-size: 30px;margin-left:95%;display: inline">×</p></a>
				</div>
				<div class="col-sm-10 d2" style="width: 100%;margin-top: 5%">
					<div style="display: inline;float: left;width: 50%;margin-left: 7%">
						<label class=" control-label" style="margin: 0 auto">选择主要元素:</label><br>
						<select id="threat3" multiple="multiple" size="6"  class="form-control"style="height: 10%;display: inline">
						</select>
					</div>
					<div style="display: inline;float: right">
						<label class=" control-label" style="margin: 0 auto">选择主要的水类:</label><br>
						<input type="radio" name="water_category3" value="lake" id="lake3" onclick=changeThreat('threat3','waterCategory3','lake','environment')><label style="font-size: 15px;margin-left: 3px">湖泊</label><br>
						<input type="radio" name="water_category3" value="river" id="river3" onclick=changeThreat('threat3','waterCategory3','river','environment')><label style="font-size: 15px;margin-left: 3px">河流</label><br>

						<label class=" control-label" style="margin: 0 auto">选择水体类型:</label><br>
						<input type="radio" name="body_type2" value="fresh" id="fresh2" onclick=changeThreat('threat3','bodyType2','fresh','environment')><label style="font-size: 15px;margin-left: 3px">淡水</label><br>
						<input type="radio" name="body_type2" value="salt" id="salt2" onclick=changeThreat('threat3','bodyType2','salt','environment')><label style="font-size: 15px;margin-left: 3px">咸水</label><br>

						<button type="button" onclick = "closeThreat('eThreat','eFade'),maxPersistenceCaculate('PerTox3','substance3','persistence3','haz_waster_quantity','waste_cha')" class="btn btn-info">
							保存并返回</button>
					</div>
				</div>
				<div style="padding-top: 30%;">
					<table width="90%" class="tableThreat" id="tableThreat3">

					</table>
				</div>
			</div>
			<div id="eFade" class="black_overlay"></div>




		</div>
		<div class="form-group"><label class="col-sm-2 control-label">使用物质:</label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="substance"  >-->
				<select name="substance3" class="form-control" id="substance3" style="width: 50%">
				</select>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">23b.生物积累性:</label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="likelihood_of_exposure"  >-->
				<select name="ecosystem_bap_value" id="ecosystem_bap_value"  value="" class="form-control"  style="width: 50%">
					<option>0.5</option>
					<option>5</option>
					<option>50</option>
					<option>500</option>
					<option>5000</option>
					<option>50000</option>
				</select>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">24.污染物数量因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" value="$!{surfaceWater.haz_waster_quantity}"  name="haz_waster_quantity" id="haz_waster_quantity"   readonly>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">25.污染物特征因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control"  name="waste_cha" id="waste_cha"  value="$!{surfaceWater.waste_cha}" readonly>
			</div>
		</div>
		<div class="hr-line-dashed"></div>
		<div class="form-group"><label class=" control-label" style="margin: 0 6%">目标因子值:</label>
		</div>
		<div class="form-group"><label class=" control-label" style="margin: 0 auto">26.敏感环境目标因子值:<a onclick="surface(this.name)" name="4-23">(4-23)</a><a onclick="surface(this.name)" name="4-24">(4-24)</a></label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">26a.暴露于水平1浓度的目标因子值：</label>
			<div class="col-sm-10 d1">
				<input type="text"  class="form-control" id="pop_concent13" name="pop_concent13"  placeholder="请输入该目标因子值" data-rule="人口目标因子值1:required;pop_concent1" value="$!{surfaceWater.pop_concent13}">
				<div class="alert alert-warning alert-dismissible" role="alert" style="display: none" id="26aErrMsg">
					<!--data-dismiss="alert" aria-label="Close"-->
					<button type="button" class="close"  id="26aMsg" onclick="closeErr(this.id)"><span aria-hidden="true">&times;</span></button>
					<strong>错误!</strong> 请输入正确数值！
				</div>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">26b.暴露于水平2浓度的目标因子值：</label>
			<div class="col-sm-10 d1">
				<input type="text"  class="form-control" id="pop_concent23" name="pop_concent23"  placeholder="请输入该目标因子值" data-rule="人口目标因子值2:required;pop_concent23" value="$!{surfaceWater.pop_concent23}">
				<div class="alert alert-warning alert-dismissible" role="alert" style="display: none" id="26bErrMsg">
					<!--data-dismiss="alert" aria-label="Close"-->
					<button type="button" class="close"  id="26bMsg" onclick="closeErr(this.id)"><span aria-hidden="true">&times;</span></button>
					<strong>错误!</strong> 请输入正确数值！
				</div>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">26c.暴露于潜在污染的目标因子值：</label>
			<div class="col-sm-10 d1">
				<input type="text"  class="form-control" id="potential_contanmination3" name="potential_contanmination3"  placeholder="请输入该目标因子值" data-rule="潜在人口目标因子值:required;potential_contanmination" value="$!{surfaceWater.potential_contanmination3}">
				<div class="alert alert-warning alert-dismissible" role="alert" style="display: none" id="26cErrMsg">
					<!--data-dismiss="alert" aria-label="Close"-->
					<button type="button" class="close"  id="26cMsg" onclick="closeErr(this.id)"><span aria-hidden="true">&times;</span></button>
					<strong>错误!</strong> 请输入正确数值！
				</div>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">26d.敏感环境目标因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" id="pop_sensitive_environments" name="pop_sensitive_environments"  value="#if ( $surfaceWater ) $!{surfaceWater.pop_sensitive_environments}  #else  0  #end" readonly>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">27.目标因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" id="target3" name="target3"  value="#if ( $surfaceWater ) $!{surfaceWater.pop_sensitive_environments}  #else  0  #end" readonly>
			</div>
		</div>
		<div class="form-group"><label class=" control-label" style="margin: 0 5%">环境威胁评分:</label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">28.环境威胁评分:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" id="environment_score" name="environment_score"  value="$!{surfaceWater.environment_score}" readonly>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label" >未经扫描得分:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" name="uncapped_score3"  value="$!{surfaceWater.uncapped_score3}" readonly id="uncapped_score3">
			</div>
		</div>
		<div class="hr-line-dashed"></div>
		<div class="form-group"><label class="col-sm-2 control-label" >地表水/地表径流总分:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" name="watershed_score"  value="$!{surfaceWater.watershed_score}" readonly id="watershed_score">
			</div>
		</div>
		<div class="hr-line-dashed"></div>
		<!--<div class="form-group">
			<p>示例弹出层：<a href = "javascript:void(0)" onclick = "openThreat('light','fade')">请点这里</a></p>
			<div id="light" class="white_content">这是一个层窗口示例程序.
				<a href = "javascript:void(0)" onclick = "closeThreat('light','fade')">点这里关闭本窗口</a></div>
			<div id="fade" class="black_overlay"></div>
		</div>-->
		<div class="form-group">
			<div class="text-center">
                <a class="btn btn-primary btn-next" href="#springUrl('/groundWater/index/')${siteId}/0" >  <  </a>
				<button class="btn btn-primary" type="submit">保 存</button>
                <a class="btn btn-primary btn-next" href="#springUrl('/surfaceWater/index/')${siteId}/0/0/1" >  >  </a>
			</div>
		</div>
	</form>
	<div class="row ibox-content" style="margin:3%;padding: 4% 2%">
		<div id="tabContainer"></div>
		<div class="row">
			<div class="col-sm-12">
				<!--
                            <table id="dataTable"></table>
                -->
				<table width="100%" class="tableThreat" id="tableIndex">
				</table>

			</div>
		</div>
	</div>


<!--<script src="#springUrl('/static/js/plugins/bootstrap-table/bootstrap-table.min.js')"></script>
<script src="#springUrl('/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js')"></script>
<script src="#springUrl('/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js')"></script>
&lt;!&ndash;<script src="#springUrl('/static/js/base_list.js')"></script>&ndash;&gt;
<script src="#springUrl('/static/js/common.js')"></script>
&lt;!&ndash;<script src="#springUrl('/static/js/jquery-2.1.1.js')"></script>&ndash;&gt;
<script src="#springUrl('/static/plugins/layer-v2.2/layer/layer.js')"></script>
&lt;!&ndash;<script src="#springUrl('/static/plugins/nice-validator-0.8.1/jquery.validator.js?local=zh-CN')"></script>&ndash;&gt;
<script src="#springUrl('/static/plugins/nice-validator-0.8.1/jquery.validator.js')"></script>-->
	<script src="#springUrl('/static/js/plugins/bootstrap-table/bootstrap-table.min.js')"></script>
	<script src="#springUrl('/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js')"></script>
	<script src="#springUrl('/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js')"></script>
	<script src="#springUrl('/static/js/common.js')"></script>
	<script src="#springUrl('/static/plugins/layer-v2.2/layer/layer.js')"></script>
	<script src="#springUrl('/static/js/lib/less.js')"></script>
	<script src="#springUrl('/static/js/lib/jquery.min.js')"></script>
	<script src="#springUrl('/static/js/lib/lib.js')"></script>
	<script src="#springUrl('/static/plugins/nice-validator-0.8.1/jquery.validator.js?local=zh-CN')"></script>

<script type="text/javascript">
    var roleList=JSON.parse('${sWList}');
 /*   if('${surfaceWater}'){
        var surfaceWater = JSON.parse('${surfaceWater}');
	}*/

    var Obs_release =$('#Obs_release');
    var containment =$('#containment');
    var runoff =$('#runoff');
    var dis_surface_water =$('#dis_surface_water');
    var overland_flow =$('#overland_flow');
    var pot_containment =$('#pot_containment');
    var pot_flood_frequency =$('#pot_flood_frequency');
    var pot_pot_to_rele_flo =$('#pot_pot_to_rele_flo');
    var pro_to_release =$('#pro_to_release');
    var likeihood_release =$('#likeihood_release');
    var haza_quantity =$('#haza_quantity');
    var waste_characteristics =$('#waste_characteristics');
    var nearest_intake =$('#nearest_intake');
    var pop_concent1 =$('#pop_concent1');
    var pop_concent2 =$('#pop_concent2');
    var potential_contanmination =$('#potential_contanmination');
    var population =$('#population');
    var resource =$('#resource');
    var target =$('#target');
    var drinking_water_score =$('#drinking_water_score');
    var uncapped_score =$('#uncapped_score');
    var likeihood_release2 =$('#likeihood_release2');
    var haza_quantity2 =$('#haza_quantity2');
    var bioa_val = $('#bioa_val');
    var waste_characteristics2 =$('#waste_characteristics2');
    var food_chain_individual =$('#food_chain_individual');
    var pop_concent12 =$('#pop_concent12');
    var pop_concent22 =$('#pop_concent22');
    var pot_HFC_concent =$('#pot_HFC_concent');
    var population2 =$('#population2');
    var target2 =$('#target2');
    var human_food_chain_score =$('#human_food_chain_score');
    var uncapped_score2 =$('#uncapped_score2');
    var likeihood_release3 =$('#likeihood_release3');
    var haz_waster_quantity =$('#haz_waster_quantity');
    var ecosystem_bap_value = $('#ecosystem_bap_value');
    var waste_cha =$('#waste_cha');
    var pop_concent13 =$('#pop_concent13');
    var pop_concent23 =$('#pop_concent23');
    var potential_contanmination3 =$('#potential_contanmination3');
    var pop_sensitive_environments =$('#pop_sensitive_environments');
    var target3 =$('#target3');
    var environment_score =$('#environment_score');
    var uncapped_score3 =$('#uncapped_score3');
    var watershed_score =$('#watershed_score');

    var sdList=JSON.parse('${sdList}');
    var tableThreat = document.getElementById('tableThreat');
    var tableThreat2 = document.getElementById('tableThreat2');
    var tableThreat3 = document.getElementById('tableThreat3');
    var substance = document.getElementById('substance');
    var substance2 = document.getElementById('substance2');
    var substance3 = document.getElementById('substance3');
    var toxcity = new Array;
    var maxPersistence = 0;
    var maxPersistence2 = 0;
    var maxPersistence3 = 0;
    var maxPersistenceId = new Array;
    var maxPersistenceId2 = new Array;
    var maxPersistenceId3 = new Array;
    var maxId=1;
    var maxId2=1;
    var maxId3=1;
    var persistence = $('#persistence');
    var persistence2 = $('#persistence2');
    var persistence3 = $('#persistence3');
    //var haza_quantity = $('#haza_quantity');
    var type = new Array;
    //此处tox应乘上一个值，从缓存获取
    for(t = 0;t<sdList.length;t++){
        // type[t] = JSON.parse(sdList[t].select_type);

            if(sdList[t].select_type!=null){
                type[t] = JSON.parse(sdList[t].select_type);
            }else{
                type[t] = new Object();
                type[t].waterCategory='lake';
                type[t].waterCategory2='lake';
                type[t].waterCategory3='lake';
                type[t].bodyType='fresh';
                type[t].bodyType2='fresh';
            }

     //   sdList[t].select_type = type[t];
        toxcity[t] = sdList[t].tox;
        if(sdList[t].tox>maxPersistence){
            maxPersistence=sdList[t].tox;
            maxPersistenceId.slice(0,maxPersistenceId.length);
            maxPersistenceId[0] =  t;
            maxId=1;
		}else if(sdList[t].tox==maxPersistence){
            maxPersistenceId[maxId] = t;
            maxId++;
		}
        if(sdList[t].tox>maxPersistence2){
            maxPersistence2=sdList[t].tox;
            maxPersistenceId2.slice(0,maxPersistenceId2.length);
            maxPersistenceId2[0] =  t;
            maxId2=1;
        }else if(sdList[t].tox==maxPersistence2){
            maxPersistenceId2[maxId2] = t;
            maxId2++;
        }
        if(sdList[t].tox>maxPersistence3){
            maxPersistence3=sdList[t].tox;
            maxPersistenceId3.slice(0,maxPersistenceId3.length);
            maxPersistenceId3[0] =  t;
            maxId3=1;
        }else if(sdList[t].tox==maxPersistence3){
            maxPersistenceId3[maxId3] = t;
            maxId3++;
        }
	}
    persistence.val(maxPersistence);
    persistence2.val(maxPersistence2);
    persistence3.val(maxPersistence3);
    var op = "";
    var op2 = "";
    var op3 = "";
    for (i=0;i<maxPersistenceId.length;i++){

    //    alert(maxPersistenceId[i]);
        op+="<option>"+sdList[maxPersistenceId[i]].chnname+"</option>"
	}
    substance.innerHTML = op;
    for (i=0;i<maxPersistenceId2.length;i++){

        //    alert(maxPersistenceId[i]);
        op2+="<option>"+sdList[maxPersistenceId2[i]].chnname+"</option>"
    }
    substance2.innerHTML = op2;
    for (i=0;i<maxPersistenceId3.length;i++){

        //    alert(maxPersistenceId[i]);
        op3+="<option>"+sdList[maxPersistenceId3[i]].chnname+"</option>"
    }
    substance3.innerHTML = op3;

    //按保存后再获取最大值
	function maxPersistenceCaculate(tox,substance,persistence,quantity,characteristicsId) {
	  //  alert("哈哈哈");
        var sub = document.getElementById(substance);
        var toxcity1 = new Array;
        var maxPersistence1 = -1;
        var maxPersistenceId1 = new Array;
        var maxId1=1;
        var bvalue = 1;
        for(t = 0;t<sdList.length;t++){
            toxcity1[t] = document.getElementById(tox+t).innerText;
            if( parseFloat(toxcity1[t])>parseFloat(maxPersistence1)){
                maxPersistence1= toxcity1[t];
                maxPersistenceId1.slice(0,maxPersistenceId1.length);
                maxPersistenceId1[0] =  t;
                maxId1=1;
            }else if( parseFloat(toxcity1[t])==parseFloat(maxPersistence1)){
                maxPersistenceId1[maxId1] = t;
                maxId1++;
            }
        }
        //document.getElementById(persistence).value=maxPersistence1;
		if(tox == 'PerTox2'){
            var BioValue = document.getElementById('BioValue'+maxPersistenceId1[0]).innerText;
            bvalue = bioa_val.val();
            maxPersistence1 = maxPersistence1/BioValue;
        }
		if(tox=='PerTox3'){
            var Bap_value = document.getElementById('Bap_value'+maxPersistenceId1[0]).innerText;
            bvalue=ecosystem_bap_value.val();
            maxPersistence1 = maxPersistence1/Bap_value;
        }
        $("#"+persistence).val(maxPersistence1);
        caculateHazaQuantity($("#"+quantity),maxPersistence1,$("#"+characteristicsId),bvalue);
        caculateDrinking_water_score();
        caculateEnvironment_score();
        caculateHuman_food_chain_score();

        var op1 = "";
        for (i=0;i<maxPersistenceId1.length;i++){

            op1+="<option>"+sdList[maxPersistenceId1[i]].chnname+"</option>";
        }
        sub.innerHTML = op1;
    }

    //表中值应随点击的选项而改变，目前未修改
    function changeThreat(id,key,value,threatType) {
        var myselect=document.getElementById(id);
        //获取大选择框即毒素名的选择
        var index=myselect.selectedIndex;
     // alert(index);
        var tox = document.getElementById("tox"+index).innerText;
        var waterLake =document.getElementById("waterLake"+index).innerText;
        var waterRiv = document.getElementById("waterRiv"+index).innerText;
        var foodFresh = document.getElementById("foodFresh"+index).innerText;
        var foodSalt = document.getElementById("foodSalt"+index).innerText;
        var ecFresh = document.getElementById("EcFresh"+index).innerText;
        var ecSalt = document.getElementById("EcSalt"+index).innerText;
        var PerValue2 = document.getElementById("PerValue2"+index).innerText;
        var BioValue = document.getElementById("BioValue"+index).innerText;
        var BapFresh = document.getElementById("BapFresh"+index).innerText;
        var BapSalt = document.getElementById("BapSalt"+index).innerText;
        var EcValue = document.getElementById("Ec_value"+index).innerText;
        var PerValue3 = document.getElementById("PerValue3"+index).innerText;
        var BapValue = document.getElementById("Bap_value"+index).innerText;
        //赋值于type中，使之不会跳转回原来的选项
		type[index][key] = value;

       // alert(type[index]);
		if(document.getElementById(key+index)){
            document.getElementById(key+index).innerHTML=value;
		}
		if(threatType =="water"){
		    if(value=="lake"){
           document.getElementById("PerValue"+index).innerHTML=waterLake;
                document.getElementById("PerTox"+index).innerHTML=waterLake*tox;
            }else  if(value=="river"){
               document.getElementById("PerValue"+index).innerHTML=waterRiv;
                document.getElementById("PerTox"+index).innerHTML=waterRiv*tox;
            }
		}else if(threatType =="food"){
            if(value=="lake"){
                document.getElementById("PerValue2"+index).innerHTML=waterLake;
                document.getElementById("PerTox2"+index).innerHTML=waterLake*tox*BioValue;
            }else  if(value=="river"){
                document.getElementById("PerValue2"+index).innerHTML=waterRiv;
                document.getElementById("PerTox2"+index).innerHTML=waterRiv*tox*BioValue;
            }else if(value=="fresh"){
                document.getElementById("BioValue"+index).innerHTML=foodFresh;
               // alert(PerValue2);
                document.getElementById("PerTox2"+index).innerHTML=foodFresh*tox*PerValue2;
            }else if(value=="salt"){
                document.getElementById("BioValue"+index).innerHTML=foodSalt;
                //alert(PerValue2);
                document.getElementById("PerTox2"+index).innerHTML=foodSalt*tox*PerValue2;
            }
        }else if(threatType =="environment"){
            if(value=="lake"){
                document.getElementById("PerValue3"+index).innerHTML=waterLake;
              	 document.getElementById("PerTox3"+index).innerHTML=waterLake*EcValue*BapValue;
            }else  if(value=="river"){
                document.getElementById("PerValue3"+index).innerHTML=waterRiv;
               // document.getElementById("PerTox"+index).innerHTML=waterRiv*EcValue*BapValue;
            }
            if(value=="fresh"){
                document.getElementById("Ec_value"+index).innerHTML=ecFresh;
                document.getElementById("Bap_value"+index).innerHTML=BapFresh;
                // alert(PerValue2);
                document.getElementById("PerTox3"+index).innerHTML=ecFresh*BapFresh*PerValue3;
            }else if(value=="salt"){
                document.getElementById("Ec_value"+index).innerHTML=ecSalt;
                document.getElementById("Bap_value"+index).innerHTML=BapSalt;
                //alert(PerValue2);
                document.getElementById("PerTox3"+index).innerHTML=ecSalt*BapSalt*PerValue3;
            }
        }


    }
    
    function decodeMessage(){

        var tmp="";
        var tdd="<tr><th>元素</th><th>毒性</th><th>主要的水的类型</th><th>持久值</th><th>毒性/持久性</th></tr>";
        var tdd2="<tr><th>元素</th><th>毒性</th><th>主要的水的类型</th><th>持久值</th><th>累计值</th><th>毒性/持久性</th></tr>";
        var tdd3="<tr><th>元素</th><th>生态毒性</th><th>生态BAP值</th><th>持久值</th><th>毒性/持久性</th></tr>";
        var Per_value = 0;
        var Per_value2 = 0;
        var Per_value3 =0;
        var Bio_value = 0;
        var Ec_value = 0;
        var Bap_value = 0;
        for(i=0;i<sdList.length;i++){

        //   var type = JSON.parse(sdList[i].select_type);
            if (type[i].waterCategory=="lake"){
                Per_value = sdList[i].pers_lak;
            }else if(type[i].waterCategory=="river"){
                Per_value = sdList[i].pers_riv;
            }
            if (type[i].waterCategory2=="lake"){
                Per_value2 = sdList[i].pers_lak;
            }else if(type[i].waterCategory2=="river"){
                Per_value2 = sdList[i].pers_riv;
            }
            if (type[i].waterCategory3=="lake"){
                Per_value3 = sdList[i].pers_lak;
            }else if(type[i].waterCategory3=="river"){
                Per_value3 = sdList[i].pers_riv;
            }
            if (type[i].bodyType=="fresh"){
                Bio_value = sdList[i].bcff;
            }else if(type[i].bodyType=="salt"){
                Bio_value = sdList[i].bcfs;
            }
            if (type[i].bodyType2=="fresh"){
                Ec_value = sdList[i].tox_fen;
                Bap_value=sdList[i].bcfef;
            }else if(type[i].bodyType2=="salt"){
                Ec_value = sdList[i].Tox_sen;
                Bap_value=sdList[i].bcfes;
            }

            tmp+="<option id="+sdList[i].id+" onclick = getOption("+i+") >"+sdList[i].chnname+"</option>";
            tdd+="<tr><td>"+sdList[i].chnname+"</td><td id='tox"+i+"'>"+sdList[i].tox+"</td><td id='waterCategory"+i+"'>"+type[i].waterCategory+"</td><td id='PerValue"+i+"'>"+Per_value+"</td><td id='PerTox"+i+"'>"+Per_value*sdList[i].tox+"</td><td style='display: none;' id='waterLake"+i+"'>"+sdList[i].pers_lak+"</td><td style='display: none;'id='waterRiv"+i+"'>"+sdList[i].pers_riv+"</td></tr>";
            tdd2+="<tr><td>"+sdList[i].chnname+"</td><td>"+sdList[i].tox+"</td><td id='waterCategory2"+i+"'>"+type[i].waterCategory2+"</td><td id='PerValue2"+i+"'>"+Per_value2+"</td><td id='BioValue"+i+"'>"+Bio_value+"</td><td id='PerTox2"+i+"'>"+Bio_value*Per_value2*sdList[i].tox+"</td><td style='display: none;' id='foodFresh"+i+"'>"+sdList[i].bcff+"</td><td style='display: none;'id='foodSalt"+i+"'>"+sdList[i].bcfs+"</td></tr>";
            tdd3+="<tr><td>"+sdList[i].chnname+"</td><td id='Ec_value"+i+"'>"+Ec_value+"</td><td id='Bap_value"+i+"'>"+Bap_value+"</td><td id='PerValue3"+i+"'>"+Per_value3+"</td><td id='PerTox3"+i+"'>"+(Ec_value*Bap_value*Per_value3).toFixed(0)+"</td><td style='display: none' id='EcFresh"+i+"'>"+sdList[i].bcfef+"</td><td style='display: none;' id='EcSalt"+i+"'>"+sdList[i].bcfes+"</td><td style='display: none' id='BapFresh"+i+"'>"+sdList[i].a_enf+"</td><td style='display: none' id='BapSalt"+i+"'>"+sdList[i].a_ens+"</td></tr>";
        }
        document.getElementById("threat1").innerHTML=tmp;
        document.getElementById("threat2").innerHTML=tmp;
        document.getElementById("threat3").innerHTML=tmp;
        tableThreat.innerHTML=tdd;
        tableThreat2.innerHTML=tdd2;
        tableThreat3.innerHTML=tdd3;
        //获取最大值
        maxPersistenceCaculate("PerTox","substance","persistence");
        caculateHazaQuantity(haza_quantity,persistence.val(),waste_characteristics,1);
        maxPersistenceCaculate("PerTox2","substance2","persistence2");
        caculateHazaQuantity(haza_quantity2,persistence2.val(),waste_characteristics2,bioa_val.val());
        maxPersistenceCaculate("PerTox3","substance3","persistence3");
        caculateHazaQuantity(haz_waster_quantity,persistence3.val(),waste_cha,ecosystem_bap_value.val());
    }
    function getOption(i) {
        var lake = document.getElementById('lake');
		var river = document.getElementById('river');
        var lake2 = document.getElementById('lake2');
        var river2 = document.getElementById('river2');
        var fresh = document.getElementById('fresh');
        var salt = document.getElementById('salt');
        var lake3 = document.getElementById('lake3');
        var river3 = document.getElementById('river3');
        var fresh2 = document.getElementById('fresh2');
        var salt2 = document.getElementById('salt2');
	//	var type = JSON.parse(sdList[i].select_type);
	//	alert(type[i].bodyType);
		if (type[i].waterCategory=='lake'){
            lake.checked='checked';
		}else if(type[i].waterCategory=='river'){
            river.checked='checked';
		}

        if (type[i].waterCategory2=='lake'){
            lake2.checked='checked';
        }else if(type[i].waterCategory2=='river'){
            river2.checked='checked';
        }
        if (type[i].bodyType=='fresh'){
            fresh.checked='checked';
        }else if(type[i].bodyType=='salt'){
            salt.checked='checked';
        }

        if (type[i].waterCategory3=='lake'){
            lake3.checked='checked';
        }else if(type[i].waterCategory3=='river'){
            river3.checked='checked';
        }
        if (type[i].bodyType2=='fresh'){
            fresh2.checked='checked';
        }else if(type[i].bodyType2=='salt'){
            salt2.checked='checked';
        }
    }
	function  openThreat(id,fade) {
        var light = document.getElementById(id);
        var top =  document.documentElement.scrollTop;
        light.style.display='block';
        document.getElementById(fade).style.display='block';
		light.style.top = top+light.style.height/2 -50 + 'px' ;
    }

    function closeThreat(id,fade) {
	    var light = document.getElementById(id);
        light.style.display='none';
       document.getElementById(fade).style.display='none';
    }

    function tableCreate() {
        var tdd="<tr><th>序号</th><th>名称</th><th>分数</th><th>是否计入评分</th><th>操作</th></tr>";
        for(i=0;i<roleList.length;i++){
            var score = roleList[i].score;
            if(score>100){
                score = 100;
			}
            var used = roleList[i].used;
            var isUsed;
            if(used==true){
                isUsed = "是";
			}else {
                isUsed = "否";
			}
            tdd+="<tr><td>"+(i+1)+"</td><td>"+roleList[i].name+"</td><td>"+score.toFixed(2)+"</td><td>"+isUsed+"</td>" +
                "<td><button class='btn btn-warning'  type='button' id='editSw"+i+"' onclick='editScore("+roleList[i].id+")'>编辑</button>" +
				"<button class='btn btn-danger'  type='button' id='delSw"+i+"' onclick='delScore("+roleList[i].id+")'>删除</button></td></tr>";
        }

        document.getElementById('tableIndex').innerHTML = tdd;


    }


    $("#myForm").validator({
        valid: function(form){
            //console.log($(form).serialize());
        //    alert($(form).serialize());
            var me = this;
            // 提交表单之前，hold住表单，防止重复提交
            me.holdSubmit();

            for(t = 0;t<sdList.length;t++){
                sdList[t].select_type = JSON.stringify(type[t]).replace(/\"/g,'\\"');
            }

            $.post("#springUrl('/surfaceWater/caculateScore/"+siteId+"')",$.param({'sdList':JSON.stringify(sdList)})+'&'+$(form).serialize(),function (data) {
                parent.layer.alert("保存成功",function(){
                    parent.layer.closeAll();
                    window.parent.location.reload();
                });
            },'json');
        /*   $.ajax({
                url: "#springUrl('/surfaceWater/caculateScore')",
			//	data:JSON.stringify(json) ,
			   data: $.param({"sdList":sdList}+'&'+$(form).serialize()),
                dataType:"json",
                contentType:"application/json;charset=utf-8",
                // data : {"surfaceWaterOL":$(form).serialize(),"sdList":JSON.stringify(sdList)} ,
             //  data: "{surfaceWaterOL:'" + $(form).serialize() + "',sdList:'" +JSON.stringify(sdList) + "'}",
			//	data: $(form).serialize(),
                type: "POST",
                success: function(data){
                   // alert(data);
                    //var d = JSON.parse(data);
                    var d = data;
                    if (d.success){
                    // if(d.success && d.data){
                        window.parent.location.reload();
                        //当你在iframe页面关闭自身时
                        //var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        //parent.layer.close(index); //再执行关闭
                    } else {
                        //失败，提交表单成功后，释放hold，如果不释放hold，就变成了只能提交一次的表单
                        me.holdSubmit(false);
                    }
                }
            });*/
        }
    });


	//编辑功能
	function editScore(id) {
         window.parent.location.href = "#springUrl('/surfaceWater/index/"+siteId+"/"+id+"/0/0')";
    }

    //删除功能
    function delScore(id) {
	    //alert(id);

        $.ajax({
            type: 'POST',
            url: "#springUrl('/surfaceWater/delSurfaceScore')",
            data: $.param({'id':id,'siteId':siteId}),
            success: function (result) {
             //   alert(result.success);
                parent.layer.alert("删除成功",function(){
                    parent.layer.closeAll();
                    window.parent.location.reload();
                });
            },
            dataType: 'json'
        });
	}

    function selectIn(key,value) {
	  //  if(key==bioa_val)alert(value);
        key.children("option").each(function(){
            var temp_value = $(this).val();
            if(parseFloat(temp_value) == value){
                $(this).attr("selected","selected");
            }
        });
    }


    $(function () {
        bsStep(3);
		tableCreate();

        if(sid!=0) {
            selectIn(Obs_release,'${surfaceWater.Obs_release}');
            selectIn(nearest_intake,'${surfaceWater.nearest_intake}');
            selectIn(resource,'${surfaceWater.resource}');
            selectIn(food_chain_individual,'${surfaceWater.food_chain_individual}');
            selectIn(containment, '${surfaceWater.containment}');
            selectIn(runoff, '${surfaceWater.runoff}');
            selectIn(dis_surface_water, '${surfaceWater.dis_surface_water}');
            selectIn(pot_containment, '${surfaceWater.pot_containment}');
            selectIn(pot_flood_frequency, '${surfaceWater.pot_flood_frequency}');
            selectIn(bioa_val, '${surfaceWater.bioa_val}');
            selectIn(ecosystem_bap_value, '${surfaceWater.ecosystem_bap_value}');
            caculateWatershed_score();
        }else {
            $('#sid').val(0);
		}
        decodeMessage();
		bioa_val.change(function () {
            caculateHazaQuantity(haza_quantity2,persistence2.val(),waste_characteristics2,bioa_val.val());
        });
        ecosystem_bap_value.change(function () {
            caculateHazaQuantity(haz_waster_quantity,persistence3.val(),waste_cha,ecosystem_bap_value.val());
        });

        Obs_release.change(function () {
            caculateLikeihood_release();
        });

        containment.change(function () {
			caculateOverland_flow();
        });
        runoff.change(function () {
            caculateOverland_flow();
        });
        dis_surface_water.change(function () {
            caculateOverland_flow();
        });
        pot_containment.change(function () {
            caculatePot_pot_to_rele_flo();
        });
        pot_flood_frequency.change(function () {
            caculatePot_pot_to_rele_flo();
        });

        pop_concent1.change(function () {
			caculatePopulation();
        });
        pop_concent2.change(function () {
            caculatePopulation();
        });
        potential_contanmination.change(function () {
            caculatePopulation();
        });
        nearest_intake.change(function () {
			caculateTarget();
        });
        resource.change(function () {
            caculateTarget();
        });

        pop_concent12.change(function () {
            caculatePopulation2();
        });
        pop_concent22.change(function () {
            caculatePopulation2();
        });
        pot_HFC_concent.change(function () {
            caculatePopulation2();
        });
        food_chain_individual.change(function () {
			caculateTarget2();
        });

        pop_concent13.change(function () {
            caculatePop_sensitive_environments();
        });
        pop_concent23.change(function () {
            caculatePop_sensitive_environments();
        });
        potential_contanmination3.change(function () {
            caculatePop_sensitive_environments();
        });
    });

    function caculateOverland_flow() {
        overland_flow.val(containment.val()*(runoff.val()*1+dis_surface_water.val()*1));
        caculatePro_to_release();
    }

    function caculatePot_pot_to_rele_flo () {
        pot_pot_to_rele_flo.val(pot_containment.val()*pot_flood_frequency.val());
        caculatePro_to_release();
    }

    function caculatePro_to_release() {
        var ptr = overland_flow.val()*1+pot_pot_to_rele_flo.val()*1;
        if (ptr > 500){
            ptr = 500;
		}
        pro_to_release.val(ptr);
        caculateLikeihood_release();
    }

    function caculateLikeihood_release() {
        if (parseInt(Obs_release.val())>parseInt(pro_to_release.val())){
            likeihood_release.val(Obs_release.val());
            likeihood_release2.val(Obs_release.val());
            likeihood_release3.val(Obs_release.val());
            caculateDrinking_water_score();
            caculateHuman_food_chain_score();
            caculateEnvironment_score();
		}else {
            likeihood_release.val(pro_to_release.val());
            likeihood_release2.val(pro_to_release.val());
            likeihood_release3.val(pro_to_release.val());
            caculateDrinking_water_score();
            caculateHuman_food_chain_score();
            caculateEnvironment_score();
		}
    }

    function caculatePopulation() {
        var f = (pop_concent1.val()*10+pop_concent2.val()*1+potential_contanmination.val()*0.1).toFixed(3);
        population.val(f.substring(0,f.length-1));
        caculateTarget();
    }

    function caculateTarget() {
        target.val(nearest_intake.val()*1+population.val()*1+resource.val()*1);
        caculateDrinking_water_score();
    }

    function caculateDrinking_water_score() {
        var e = ((likeihood_release.val()*waste_characteristics.val()*target.val())/82500).toFixed(3);
        uncapped_score.val(e.substring(0,e.length-1));
        if(parseFloat(uncapped_score.val())>100){
            drinking_water_score.val(100);
            caculateWatershed_score();
        }else {
            drinking_water_score.val(uncapped_score.val());
            caculateWatershed_score();
		}
    }

    function caculatePopulation2() {
        var d = (pop_concent12.val()*10+pop_concent22.val()*1+pot_HFC_concent.val()*0.1).toFixed(3);
        population2.val(d.substring(0,d.length-1));
        caculateTarget2();
    }
    
    function caculateTarget2() {
        target2.val(food_chain_individual.val()*1+population2.val()*1);
        caculateHuman_food_chain_score();
    }

    function caculateHuman_food_chain_score() {
        var c = ((likeihood_release2.val()*waste_characteristics2.val()*target2.val())/82500).toFixed(3);
        uncapped_score2.val(c.substring(0,c.length-1));
        if(parseFloat(uncapped_score2.val())>100){
            human_food_chain_score.val(100);
            caculateWatershed_score();
        }else {
            human_food_chain_score.val(uncapped_score2.val());
            caculateWatershed_score();
        }
    }

    function caculatePop_sensitive_environments() {
        var b = (pop_concent13.val()*10+pop_concent23.val()*1+potential_contanmination3.val()*0.1).toFixed(3);
        pop_sensitive_environments.val(b.substring(0,b.length-1));
        target3.val(pop_sensitive_environments.val());
        caculateEnvironment_score();
    }

    function caculateEnvironment_score() {
        var a = ((likeihood_release3.val()*waste_cha.val()*target3.val())/82500).toFixed(3);
        uncapped_score3.val(a.substring(0,a.length-1));
        if(parseFloat(uncapped_score3.val())>100){
            environment_score.val(100);
            caculateWatershed_score();
        }else {
            environment_score.val(uncapped_score3.val());
            caculateWatershed_score();
        }
    }

    function caculateHazaQuantity(quantity,persistence,characteristics,bValue) {
        //alert(persistence);
		if(parseFloat(persistence)<=0){
		    quantity.val(0);
		}else if(parseFloat(persistence)>0&&parseFloat(persistence)<=100){
            quantity.val(1);
		}else if(parseFloat(persistence)>100&&parseFloat(persistence)<=10000){
            quantity.val(100);
        }else if(parseFloat(persistence)>10000&&parseFloat(persistence)<=1000000){
            quantity.val(10000);
        }else if(parseFloat(persistence)>1000000){
            quantity.val(1000000);
        }
        caculateCharacteristics(quantity,persistence,characteristics,bValue);
        caculateEnvironment_score();
        caculateHuman_food_chain_score();
        caculateDrinking_water_score();
    }

    function caculateCharacteristics(quantity,persistence,characteristics,bValue) {

        var t = quantity.val()*persistence*bValue;
        //alert(bValue);
        if(t ==0){
            characteristics.val(0);
        }else if(t>0&&t<10){
            characteristics.val(1);
        }else if(t>=10&&t<100){
            characteristics.val(2);
        }else if(t>=100&&t<1000){
            characteristics.val(3);
        }else if(t>=1000&&t<10000){
            characteristics.val(6);
        }else if(t>=10000&&t<100000){
            characteristics.val(10);
        }else if(t>=100000&&t<1000000){
            characteristics.val(18);
        }else if(t>=1000000&&t<10000000){
            characteristics.val(32);
        }else if(t>=10000000&&t<100000000){
            characteristics.val(56);
        }else if(t>=100000000&&t<1000000000){
            characteristics.val(100);
        }else if(t>=1000000000&&t<10000000000){
            characteristics.val(180);
        }else if(t>=10000000000&&t<100000000000){
            characteristics.val(320);
        }else if(t>=100000000000&&t<1000000000000){
            characteristics.val(560);
        }else if(t>=1000000000000){
            characteristics.val(1000);
        }
    }



    function caculateWatershed_score() {
        var score = drinking_water_score.val()*1+human_food_chain_score.val()*1+environment_score.val()*1;
        if(parseFloat(score)>100){
            watershed_score.val(100);
        }else {
            watershed_score.val(score);
        }
    }

    function openErr(id) {
        //alert(id);
        $('#'+id+'ErrMsg').css('display','block');
    }
    function closeErr(id) {
        $('#'+id).parent().css('display','none');
    }
    function isDigit(s)
    {
        var patrn=/^[0-9]{1,20}$/;
        if (!patrn.exec(s)) {
            // alert("false");
            return false;
        }
        // alert("true");
        return true;
    }

    function surface(id) {
        var title = "表"+id;
        var url = "#springUrl('/surfaceWater/surface"+id+"')";
        layer.open({
            type: 2,
            title: title,
            shadeClose: true,
            shade: 0.8,
            area: ['760px', '430px'],
            fix: false,
            maxmin: false,
            content: url
        });
    }
</script>

